package com.lcredu.web.viewresolver;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @author 黎长容
 * @date 2025-07-21 18:31
 */
@Controller
@RequestMapping("/goods")
public class GoodsHandler {

    @RequestMapping("/buy")
    public String buy() {
        System.out.println("----buy()----");
        return "lcrView";
    }
    
    //只会发一次请求,且可以请求到WEB-INF目录下面
    //测试请求转发
    @RequestMapping("/info_forward")
    public String forward(){
        System.out.println("----forward()----");
        return "forward:/WEB-INF/pages/my_view.jsp";
    }

    //会发出两次请求,不可以请求到WEB-INF目录下面
    @RequestMapping("/redirect")
    public String redirect(){
        System.out.println("----redirect()----");
        return "redirect:/WEB-INF/pages/my_view.jsp";
    }
}
